using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Web.UI.Design;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Web.UI;
using System.ComponentModel;

namespace Antu.WebControlLibrary.Designer
{
    class MessageBoxDesigner : ControlDesigner
    {
        MessageBox mb = null;
        public override void Initialize(System.ComponentModel.IComponent combonent)
        {
            this.mb = (MessageBox)combonent;
            base.Initialize(combonent);

        }

        public override string GetDesignTimeHtml()
        {
            StringWriter writer1 = new StringWriter();
            HtmlTextWriter writer2 = new HtmlTextWriter(writer1);
            HtmlTable table1 = new HtmlTable();
            table1.CellPadding = 3;
            table1.CellSpacing = 0;
            if (mb.Width != null)
            	table1.Width = mb.Width.ToString();			

            if (mb.Height != null)
            	table1.Height = mb.Height.ToString();

            HtmlTableRow row1 = new HtmlTableRow();
            HtmlTableCell cell1 = new HtmlTableCell();
            cell1.VAlign = "top";
            cell1.Align = "center";

            HtmlTable table2 = new HtmlTable();
            table2.BgColor = "#FFFFFF";
            table2.Width = "100%";
            table2.Height = "100%";
            table2.CellPadding = 0;
            table2.CellSpacing = 0;
            //table2.Style.Add("border", "1 solid " + ColorTranslator.ToHtml(this.ftb.EditorBorderColorDark));
            HtmlTableRow row2 = new HtmlTableRow();
            HtmlTableCell cell2 = new HtmlTableCell();
            cell2.VAlign = "middle";
            cell2.Align = "center";
            cell2.Controls.Add(new LiteralControl("<b><font face=arial size=2><font color=green>MessageBox:</font></b>" + mb.Text + "</font>"));
            row2.Cells.Add(cell2);
            table2.Rows.Add(row2);

            cell1.Controls.Add(table2);
            //cell1.Controls.Add(new LiteralControl("<br><br><br>"));
            row1.Cells.Add(cell1);
            table1.Rows.Add(row1);
            table1.RenderControl(writer2);
            return writer1.ToString();
        }
    }
}
